package com.xdap.common.util;


import org.apache.commons.collections.MapUtils;
import org.apache.commons.collections4.IterableUtils;
import org.apache.commons.collections4.IteratorUtils;
import org.springframework.util.StringUtils;

import java.util.Iterator;
import java.util.Map;

public class FeishuStrUtil {
    public static boolean isNotEmpty(Object obj) {
        return !isEmpty(obj);
    }

    public static boolean isEmpty(Object obj) {
        if (null == obj) {
            return true;
        }

        if (obj instanceof CharSequence) {
            return StringUtils.isEmpty((CharSequence) obj);
        } else if (obj instanceof Map) {
            return MapUtils.isEmpty((Map) obj);
        } else if (obj instanceof Iterable) {
            return IterableUtils.isEmpty((Iterable) obj);
        } else if (obj instanceof Iterator) {
            return IteratorUtils.isEmpty((Iterator) obj);
        }
        return false;
    }
}
